<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>案例7</title>
    <link rel="stylesheet" href="../css/index.css">
    <style>
        .d1 {
            flex-direction: column;
            border: 1px solid black;
        }
        
        li {
            list-style: square;
        }
        
        .tab {
            background-color: #000;
            height: 40px;
            cursor: pointer;
            padding: 0 10px;
        }
        
        .tab div {
            color: #eee;
            height: 100%;
            margin: 0 10px;
            padding: 0 10px;
            display: flex;
            align-items: center;
        }
        
        .tab div:hover {
            background-color: silver;
        }
        
        .d2 {
            padding: 0 20px;
        }
        
        ul {
            display: none;
        }
    </style>
</head>

<body>
    <div class="content flex d1">
        <div class="flex tab a-c">
            <div class="tabitem">第一课</div>
            <div class="tabitem">第二课</div>
            <div class="tabitem">第三课</div>
        </div>
        <div class="d2">
            <ul style="display: block;">
                <li>11</li>
                <li>22</li>
                <li>33</li>
            </ul>
            <ul>
                <li>44</li>
                <li>55</li>
                <li>66</li>
                <li>33</li>
                <li>33</li>
            </ul>
            <ul>
                <li>99</li>
                <li>asd </li>
                <li>drge</li>
                <li>ergerg</li>
                <li>egrg</li>
                <li>3ergerg3</li>
                <li>555</li>
            </ul>
        </div>
    </div>

    <script>
        let items = document.querySelectorAll('.tabitem')
        let uls = document.querySelectorAll('ul')
        for (let i = 0; i < items.length; i++) {
            const r = items[i];
            r.onmousemove = function() {
                for (let j = 0; j < uls.length; j++) {
                    const ul = uls[j];
                    ul.style.display = 'none'
                }
                uls[i].style.display = 'block'

            }
        }
    </script>
</body>

</html>